package io.gitee.wminyu.day05;

import java.util.HashSet;
import java.util.Set;

public class Count {
    public static void main(String[] args) {
        int blank = 0;
        String txt = "Stack Overflow requires external JavaScript from overflow another or domain," +
                " which is blocked or failed to or load.";
        String conment = txt.toLowerCase();

        String[] count1 = conment.split("[ \\t\\n\\x0B\\f\\r]");
        int len = count1.length;
        int count = 0;
        Set<String> set = new HashSet<>();
        for (int i = 0; i < count1.length; i++) {

            set.add(count1[i]);
            if (count1[i].equals("")) {
                blank++;
            }
            for (int j=0;j<count1.length;j++){
                if (count1[i].equals(count1[j])){
                    count++;
                }
            }
            System.out.println(count1[i]+"的个数为："+count);
            count = 0;
        }
        System.out.println("无重复英语单词个数为："+set.size());

        System.out.println(conment);
        System.out.println("总英语单词个数为：" + (len - blank));
    }
}
